﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CBMS.Interfaces;
using CBMS.Models;
using System.Data.Objects.DataClasses;
using System.Data.Objects;
using System.Collections;
using CBMS.Objects;
using System.Data.Objects.SqlClient;
using CBMS.Common;
using System.Data.Common;
using System.Data.EntityClient;
using System.Data;
using System.Globalization;
namespace CBMS.Business
{
   public class RolesRepository : BaseEntityRepository<Role>, IRolesRepository
    {
       public IList<ItemDTO> GetAllToComboBox()
        {
            IList<ItemDTO> lstResult = new List<ItemDTO>();
            try
            {
                var emp = (from n in DbContext.Roles
                           where n.is_active == true
                           select new ItemDTO
                           {
                               Id=n.role_code,
                               Name = n.role_name
                           });

                lstResult = emp.ToList<ItemDTO>();               
                return lstResult;
            }
            catch
            {
                return new List<ItemDTO>();
            }
        }
    }
}
